<template>
  <div>
<h1>用户账号显示</h1>
<table>
<tr>
  <td>账号id</td>
  <td>账号</td>
  <td>密码</td>
  <td>注册时间</td>
</tr>
<tr v-for="item in list">
  <td>{{item.userId}}</td>
  <td>{{item.userName}}</td>
  <td>{{item.userPwd.substr(0,4)}}***</td>
  <td>{{item.userDate.substr(0,10)}}</td>
</tr>
</table>
  </div>
</template>

<script setup lang="ts">
import {reactive,toRefs,onMounted} from 'vue'
import axios from 'axios'
import {useRoute,useRouter} from 'vue-router'
const router=useRouter()
const route=useRoute()

let data:any=reactive({
  state:{

  },
  list:[]
})

let {state,list}=toRefs(data)

onMounted(()=>{
  getList()
})

//显示功能
const getList=()=>{
  axios({
    url:'/api/Users/GetUserShow',
    method:'get',
    params:state.value
  })
  //用户显示
  .then(res=>{
    console.log(res.data);
    list.value=res.data.data;
    console.log(res.data.data.length);
  })
  //异常处理
.catch(err=>{
console.log(err);

})
}
</script>

<style scoped>

</style>